import { ElMessage, ElLoading } from "element-plus";

class Message {
  static instance: Message;
  constructor() {}
  static getInstance() {
    if (!this.instance) {
      this.instance = new Message();
    }
    return this.instance;
  }
  loading() {
    return ElLoading.service();
  }
  success(message: string) {
    ElMessage({
      type: "success",
      grouping: true,
      message
    });
  }
  error(message: string) {
    ElMessage({
      type: "error",
      grouping: true,
      message
    });
  }
  warning(message: string) {
    ElMessage({
      type: "warning",
      grouping: true,
      message
    });
  }
  info(message: string) {
    ElMessage({
      type: "info",
      grouping: true,
      message
    });
  }
}
export const message = Message.getInstance();
